//防抖
const debounce = (fn, time) => {
    let timer
    return (...args) => {
        return new Promise((resolve, reject) => {
            if (timer) {
                clearTimeout(timer)
                timer = null
            }
            timer = setTimeout(() => {
                fn.apply(this, args).then(result => {
                    resolve(result)
                })
            }, time)
        })

    }
}
export default {
    debounce
}